package com.cloud.common.core.configure;

import com.cloud.common.core.ServerProtectInterceptor;
import org.springframework.context.annotation.Bean;
import org.springframework.web.servlet.HandlerInterceptor;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;


/**
 * @Description:  全局拦截器拦截请求，并校验Zuul Token。这个拦截器需要被众多微服务模块使用，所以把它定义在通用模块febs-common里
 * @Auther: zhangxun
 * @Date: 2020/9/28 20:23
 */
public class ServerProtectConfigure implements WebMvcConfigurer {
    @Bean
    public HandlerInterceptor ServerProtectInterceptor() {
        return new ServerProtectInterceptor();
    }

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(ServerProtectInterceptor());
    }
}